package edu.hitsz.aircraft.enemy;

import edu.hitsz.application.Main;
import edu.hitsz.bullet.BaseBullet;
import edu.hitsz.bullet.EnemyBullet;
import edu.hitsz.factory.propFactory.*;
import edu.hitsz.prop.AbstractProp;
import edu.hitsz.shootStrategy.ShootDirect;
import edu.hitsz.shootStrategy.ShootStrategy;

import java.util.LinkedList;
import java.util.List;

public class EliteEnemy extends AbstractEnemy {


    public EliteEnemy(int locationX, int locationY, int speedX, int speedY, int hp) {
        super(locationX, locationY, speedX, speedY, hp);
        super.shootNum=1;
        super.power=30;

        super.setShootStrategy(new ShootDirect());
    }

    @Override
    public void forward() {
        super.forward();
        // 判定 y 轴向下飞行出界
        if (locationY >= Main.WINDOW_HEIGHT ) {
            vanish();
        }
    }



    @Override
    public List<AbstractProp> dropProp(int LocationX, int LocationY){
        double rand = Math.random();

        List<AbstractProp> abstractProps=new LinkedList<>();
        AbstractProp abstractProp;
        PropFactory propFactory;//抽象道具工厂
        if(rand<0.2){
            return abstractProps;
        }
        else if (rand < 0.4) {
            //1.创建工厂对象
            propFactory=new BloodPropFactory();
        } else if (rand < 0.7) {
            propFactory=new BombPropFactory();
        } else{
            propFactory=new BulletPropFactory();
        }
        
        abstractProp =propFactory.createProp(LocationX,LocationY);
        abstractProps.add(abstractProp);
        return abstractProps;
    }

    @Override
    public void update() {
        this.vanish();
    }
}
